package com.kotiln.lgc.sunnyweather.util

import android.util.Log

/**
 *@fileName LogUtil
 *@date2020/11/25  10:20
 *@author LogUtil$
 *@describe TODO
 *@desc 打印日志工具类
 */
object LogUtil {
    private const val VERBOSE=1
    private const val DEBUG=2
    private const val INFO=3
    private const val WARN=4
    private const val ERROR=5
    private const val isLog=true  //是否开启打印日志
    private val level=VERBOSE //设置打印哪一级别的日志

    fun v(tag:String,msg:String){
        if(isLog){
            if(level<= VERBOSE){
                Log.v(tag,msg)
            }
        }
    }

    fun d(tag:String,msg:String){
        if(isLog){
            if(level<= DEBUG){
                Log.d(tag,msg)
            }
        }

    }

    fun i(tag:String,msg:String){
        if(isLog){
            if(level<=INFO){
                Log.i(tag,msg)
            }
        }

    }

    fun w(tag:String,msg:String){
        if(isLog){
            if(level<=WARN){
                Log.w(tag,msg)
            }
        }

    }

    fun e(tag:String,msg:String){
        if(isLog){
            if(level<=ERROR){
                Log.e(tag,msg)
            }
        }

    }
}